<?php
include 'su_log.php';
include '../inc/d.php';
if (isset($POST['name'])) {
    if (empty(trim($_POST['name']))) {
        echo '请输入广告名称';
    } elseif (empty($_FILES)) {
        echo '请选择上传图片';
    } else {
        $filename=date('YmdHis').'.jpg';
        move_uploaded_file($_FILES['file']['tmp_name'], '../upload/banner/'.$filename);
        $arr_assoc['banner_name']=$_POST['name'];
        $arr_assoc['banner_filename']=$filename;
        $arr_assoc['banner_time']=time();
        $arr_assoc['banner_flag']=$_POST['flag'];
        $arr_assoc['banner_url']=$_POST['url'];
        save('hw_banner',$arr_assoc);
        header('location:banner_manager.php');
    }
}
?>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <title>admin</title>
</head>
<body>
<h3>添加广告</h3>
<form action="banner_add.php" method="post" enctype="multipart/form-data">
    广告名称：<input type="text" name="name" size="80" autofocus><br>
    广告图片：<input type="file" name="file">(格式为jpeg (1000*277))<br>
    链接地址：<input type="text" name="url" value="#"><br>
    是否显示：
    <label><input type="radio" name="flag" value="y" checked>显示</label>&nbsp;
    <label><input type="radio" name="flag" value="n">不显示</label><br>
    <hr>
    <input type="submit" value="提交">
</form>
</body>
</html>



